package StudyCode.summary.myfile;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CopyOneToAnotherOneWithFileChannel {
	public static void main(String[] args) throws Exception {
		FileChannel srcChannel = new FileInputStream("E:\\迅雷下载\\test1.txt").getChannel();
		FileChannel dstChannel = new FileOutputStream("E:\\迅雷下载\\test1.txt").getChannel();

		dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
		System.out.println("复制成功。");
		srcChannel.close();
		dstChannel.close();
	}
}
